import request from '@/utils/request'

export default{

    
    /**
     * 添加课程信息
     * @param {表单中提交的课程信息} courseInfo 
     * @returns 
     */
    addCourseInfo(courseInfo) {
        return request({
            url: '/eduservice/course/addCourseInfo',
            method: 'post',
            data: courseInfo
          })
    },

    /**
     * 课程条件查询带分页
     * @param {当前页} current 
     * @param {每页大小} limit 
     * @param {查询条件} courseQuery 
     * @returns 
     */
    pageCourseByCondition(current,limit,courseQuery) {
        return request({
            url: `/eduservice/course/pageCourse/${current}/${limit}`,
            method: 'post',
            data: courseQuery
          })
    },

    /**
     * TODO完善条件查询带分页
     * 查询课程列表
     * @returns 课程列表
     */
    getListCourse() {
        return request({
            url: '/eduservice/course',
            method: 'get'
          })
    },

    /**
     * 查询所有讲师
     */
    getListTeacher(){
        return request({
            url: '/eduservice/teacher/findAll',
            method: 'get',
        })
    },

    /**
     * 根据id查询课程信息
     * @param {课程id} courseId 
     */
    getCourseInfoId(courseId){
        return request({
            url: '/eduservice/course/getCourseInfo/' + courseId,
            method: 'get'
        })
    },


    /**
     * 修改课程信息
     * @param {提交修改的信息}} courseInfo 
     */
    updateCourseInfoId(courseInfo){
        return request({
            url: '/eduservice/course/updateCourseInfo',
            method: 'post',
            data: courseInfo
        })
    },

    /**
     * 根据课程id获取课程确认信息
     * @param {课程id}} courseId 
     * @returns 
     */
    getPublishCourseInfo(courseId){
        return request({
            url: '/eduservice/course/getPublishCourseInfo/' + courseId,
            method: 'get'
        })
    },

    /**
     * 发布课程，修改状态字段
     * @param {课程id} id 
     * @returns 
     */
    publishCourse(id){
        return request({
            url: '/eduservice/course/updateCourseStatus/' + id,
            method: 'post'
        })
    },

    /**
     * 根据课程id删除课程及下面的信息
     * @param {课程id} courseId 
     * @returns 
     */
    delteCourseById(courseId){
        return request({
            url: '/eduservice/course/' + courseId,
            method: 'delete'
        })
    }

}
